package brad.zimmerman.dungeon.game;

import java.util.ArrayList;

public class ClassStringandPictureHolder {
	private ArrayList <ClassSandPNode> nodes;
	public ClassStringandPictureHolder(){
		nodes = new ArrayList <ClassSandPNode>();
	}
	public ClassStringandPictureHolder(ClassStringandPictureHolder spHolder){
		nodes = new ArrayList <ClassSandPNode>();
		for(int i = 0; i < spHolder.getSize();i++){
			nodes.add(spHolder.getIndex(i));
		}
	}
	public void addPicture(String string, int picture, String description){
		nodes.add(new ClassSandPNode(string,picture,description));
	}
	public ClassSandPNode getIndex(int index){
		if(index < nodes.size()){
			return nodes.get(index);
		}
		else return new ClassSandPNode(null,0,null);
	}
	public int getSize(){
		return nodes.size();
	}
	public int searchPicture(String name){
		for(ClassSandPNode node:nodes){
			if(node.getTitle().indexOf(name)!=-1){
				return node.getPicture();
			}
		}
		return -1;
	}
	public String searchDescription(String name){
		for(ClassSandPNode node:nodes){
			if(node.getTitle().indexOf(name)!=-1){
				return node.getDescription();
			}
		}
		return null;
	}
}

